<template>
  <div>
    <h4>请选择你喜欢的专栏</h4>
    <span v-for="(item, index) in str" :key="index">
      <input @click="fn" type="checkbox" :value="item" />{{ item }}</span
    >
    <div>
      <ul>
        <li v-for="item in arr" :key="item">{{ item }}</li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      str: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
      arr: [],
    };
  },
  methods: {
    fn(e) {
      this.arr.push(e.target.value);
    },
  },
};
</script>

<style>
</style>